<template>
  <el-dialog :title="`${form.patStandardId ? '修改' : '添加'}检查标准`" :visible.sync="show" :close-on-click-modal="false" :show-close="!btnLoading" width="600px" @closed="$refs.form.resetFields()">
    <el-form ref="form" :model="form" :rules="rules" size="small" label-width="80px">
      <el-form-item prop="patTypeId" class="hide" />
      <el-form-item prop="patStandardId" class="hide" />
      <el-form-item label="标准内容" prop="content"><el-input v-model="form.content" type="textarea" :rows="6" placeholder="请输入标准内容" :maxlength="3000" /></el-form-item>
      <el-form-item label="是否启用" prop="isEnable"><el-switch v-model="form.isEnable" :active-value="1" :inactive-value="0" /></el-form-item>
    </el-form>
    <div slot="footer">
      <el-button type="primary" :loading="btnLoading" @click="btnSubmit">确 定</el-button>
      <el-button :disabled="btnLoading" @click="show = false">取 消</el-button>
    </div>
  </el-dialog>
</template>
<script>
// 添加或修改检查标准
import { editFormMixin } from '@/utils/mixin'
import { addPatStandard, setPatStandard } from '@/api/cq/patrol'
export default {
  mixins: [editFormMixin],
  data() {
    return {
      primaryKey: 'patStandardId',
      addApi: addPatStandard,
      updateApi: setPatStandard,
      form: {
        patTypeId: '',
        patStandardId: '',
        content: '',
        isEnable: 1
      },
      rules: {
        content: [{ required: true, message: '请输入标准内容' }]
      }
    }
  }
}
</script>
